import request from '@/utils/request'

export function fetchJobList(data) {
  return request({
    url: '/cloud-system/getJobList',
    method: 'post',
    data
  })
}

export function fetchJobOne(data) {
  return request({
    url: '/cloud-system/getOneJobDetail',
    method: 'post',
    data
  })
}

export function createJob(data) {
  return request({
    url: '/cloud-system/createOneJob',
    method: 'post',
    data
  })
}

export function updateJob(data) {
  return request({
    url: '/cloud-system/updateOneJob',
    method: 'post',
    data
  })
}

export function deleteJob(data) {
  return request({
    url: '/cloud-system/deleteOneJob',
    method: 'post',
    data
  })
}

export function lockJob(data) {
  return request({
    url: '/cloud-system/lockOneJob',
    method: 'post',
    data
  })
}

export function unlockJob(data) {
  return request({
    url: '/cloud-system/unlockOneJob',
    method: 'post',
    data
  })
}

/**
 * 移动节点顺序
 * @param {*} moveJobID 被移动的节点ID
 * @param {*} categoryID 移动到目的前后的节点ID
 * @param {*} moveSide 移动位置 1 代码移动到categoryID 之前， 2代表移动到categoryID之后
 * @param {*} token token身份认证
 * @returns
 */
export function moveOneJob(moveJobID, categoryID, moveSide, token) {
  return request.post('/cloud-system/moveOneJob', {
    moveJobID,
    categoryID,
    moveSide,
    token
  })
}
